<?php

/*------------------图片类别信息增删改查--------------*/
namespace app\member\controller\db;
use app\member\model\ClassList as ClassListModel;
use think\Controller;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;
use think\exception\DbException;

class ClassList extends Controller
{
    public function selectAllClass(){
        $class = new ClassListModel();
        try {
            $data = $class->selectOrFail();
            return $data->toArray();
        } catch (DataNotFoundException $e) {
        } catch (ModelNotFoundException $e) {
        } catch (DbException $e) {
        }
       return [];
    }

    public function  selectIdByName($classId){
        $class = new ClassListModel();
        try {
            $data = $class->where("class_id",$classId)->find();
            return ($data->toArray())['class_name'];
        } catch (DataNotFoundException $e) {
        } catch (ModelNotFoundException $e) {
        } catch (DbException $e) {
        }
        return [];
    }
}